#修改文件

import random

file = open("ANS_NEW.txt", encoding="utf-8")
file_a = open("unit_1_axx_part01.txt", encoding="utf-8")
file_b = open("unit_1_bxx_part01.txt", encoding="utf-8")
file_c = open("unit_1_cxx_part01.txt", encoding="utf-8")
file_d = open("unit_1_dxx_part01.txt", encoding="utf-8")



ls = []
ls_a = []
ls_b = []
ls_c = []
ls_d = []

for i in file.readlines():
    line = i.strip("\n")
    ls.append(i)
for i in file_a.readlines():
    line = i.strip("\n")
    ls_a.append(line)
for i in file_b.readlines():
    line = i.strip("\n")
    ls_b.append(line)
for i in file_c.readlines():
    line = i.strip("\n")
    ls_c.append(line)
for i in file_d.readlines():
    line = i.strip("\n")
    ls_d.append(line)

ls_all = [ls_a, ls_b, ls_c, ls_d]
    
for i in range(len(ls)):
    random_place = random.randint(0,3)
    ls_all[random_place][i] = ls[i]

a = open("axx.txt", "w", encoding="utf-8")
b = open("bxx.txt", "w", encoding="utf-8")
c = open("cxx.txt", "w", encoding="utf-8")
d = open("dxx.txt", "w", encoding="utf-8")

for i in ls_a:
    a.write(i+"\n")
a.close()
for i in ls_b:
    b.write(i+"\n")
b.close()
for i in ls_c:
    c.write(i+"\n")
c.close()
for i in ls_d:
    d.write(i+"\n")
d.close()





    
